import React, { useState, useRef } from 'react'
import { View, Text, ScrollView, StyleSheet } from 'react-native';
import { ToastProvider, useToast, ToastRef } from '../Toast/useToast'
import { DialogProvider } from '../Dialog/useDialog'
const InitializeToastRef = () => {
  const toast = useToast();
  ToastRef.current = toast;
  return null;
};
export default (props: any) => {

  return (
    <View style={{ flex: 1 }}>
      {/* 注入全局的toast */}
      <DialogProvider>
        <ToastProvider>
          {props.children}
          <InitializeToastRef></InitializeToastRef>
        </ToastProvider>
      </DialogProvider>
    </View>
  )
}

